home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / MacWT 0.9 / wt Source / world.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-10  |  2.6 KB  |  108 lines  |  [TEXT/CWIE]

  1. /*
  2. **  MacWT -- a 3d game engine for the Macintosh
  3. **  © 1995, Bill Hayden and Nikol Software
  4. **  Free for non-commercial use - address questions to the e-mail address below
  5. **
  6. **  Mail:           afn28988@freenet.ufl.edu (Bill Hayden)
  7. **    MacWT FTP site: ftp.circa.ufl.edu/pub/software/ufmug/mirrors/LocalSW/Hayden/
  8. **  WWW Page:       http://grove.ufl.edu:80/~nikolsw
  9. **
  10. **    All of the above addresses are due to changes sometime in 1996, so stay tuned
  11. **
  12. **  based on wt, by Chris Laurel
  13. **
  14. **  This program is distributed in the hope that it will be useful,
  15. **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. */
  18.  
  19.  
  20. #ifndef FIXED_H_
  21. #include "fixed.h"
  22. #endif
  23.  
  24. #ifndef TEXTURE_H_
  25. #include "texture.h"
  26. #endif
  27.  
  28. #ifndef TABLE_H_
  29. #include "table.h"
  30. #endif
  31.  
  32. #ifndef LIST_H_
  33. #include "list.h"
  34. #endif
  35.  
  36. typedef struct {
  37.      fixed x, y;
  38.      fixed tx, ty, proj;      /* transformed coordinates */
  39. } Vertex;
  40.  
  41.  
  42. #define Region WT_Region
  43.  
  44. typedef struct {
  45.      fixed floor, ceiling;
  46.      Texture *floor_tex, *ceiling_tex;
  47. } Region;
  48.  
  49.  
  50. typedef struct {
  51.      Vertex *vertex1, *vertex2;
  52.      Texture *surface_texture;
  53.      Region *front, *back;
  54.      fixed xphase, yphase;
  55.      fixed xscale, yscale;
  56.      Boolean sky;
  57.      Boolean opaque;
  58. } Wall;
  59.  
  60.  
  61. #define NO_WALL -1
  62.  
  63. #define MAX_VERTICES 2000
  64. #define MAX_WALLS    2000
  65. #define MAX_REGIONS  2000
  66. #define MAX_TEXTURES  200
  67. #define MAX_OBJECTS  2000
  68.  
  69. typedef struct {
  70.      Table *vertices;
  71.      Table *walls;
  72.      Table *regions;
  73.      Table *textures;
  74.      List *objects;
  75. } World;
  76.  
  77. typedef struct {
  78.     short    mass;
  79.     short    xsize;
  80.     short    ysize;
  81.     short    height;
  82.     short    gravity;
  83.     short    drag;
  84. } PhysicsData;
  85.  
  86. typedef PhysicsData **PhysicsModel;
  87.  
  88.  
  89. #define WORLD_VERTEX(w, v)   ((TABLE_ELEMENTS((w)->vertices, Vertex))[v])
  90. #define WORLD_TEXTURE(w, t)  ((TABLE_ELEMENTS((w)->textures, Texture *))[t])
  91. #define WORLD_REGION(w, r)   ((TABLE_ELEMENTS((w)->regions, Region))[r])
  92. #define WORLD_WALL(w, x)     ((TABLE_ELEMENTS((w)->walls, Wall))[x])
  93.  
  94. extern World *new_world(void);
  95. extern int add_texture(World *w, Texture *tex);
  96. extern int add_wall(World *w, Wall *wall);
  97. extern int add_vertex(World *w, Vertex *v);
  98. extern int add_region(World *w, Region *r);
  99.  
  100. extern void update_wall_scale(World *w, int wall_num,
  101.                   fixed xscale, fixed yscale);
  102. extern void update_wall_phase(World *w, int wall_num,
  103.                   fixed xphase, fixed yphase);
  104. extern void update_wall_height(World *w, int wall_num,
  105.                    fixed floor_front, fixed floor_back,
  106.                    fixed ceiling_front, fixed ceiling_back);
  107. extern Region *in_region(World *w, fixed x, fixed y);
  108.